const state = {
  raw: [{ id: 1, name: "背带裤", price: 10, count: 2 }],
};

const getters = {
  // 总价
  total(state) {
    return state.raw.reduce((result, item) => {
      return (result += item.price * item.count);
    }, 0);
  },
};

const mutations = {
  abcd() {
    console.log("Cart 模块的 abcd");
  },
};

const actions = {
  abcda() {
    console.log("Cart 模块的 abcda");
  },
};

export default {
  // 命名空间
  namespaced: true,
  state,
  getters,
  mutations,
  actions,
};
